class User < BaseModel
  self.table_name = 'GDN_User'
  self.export_table_name = 'users'
  self.export_mappings = {
    id: 'UserID',
    email: 'Email',
    username: 'Name',
    gender: 'Gender',
    show_email: 'ShowEmail',
    crypted_password: 'Password',
    role: 'role',
    created_at: 'DateInserted',
    updated_at: 'DateUpdated',
  }

  def Gender
    case read_attribute(:Gender)
    when 'm' then 'male'
    when 'f' then 'female'
    else 'unknown'
    end
  end

  def role
    if read_attribute(:Admin) == 1
      'admin'
    else
      'member'
    end
  end
end